package com.supermarket.service.lmpl;

import com.supermarket.dao.AdminDao;
import com.supermarket.entity.Bill;
import com.supermarket.entity.Provider;
import com.supermarket.service.Adminservice;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class AdminserviceImpl implements Adminservice {
    static SqlSession getsqlsession;
    static {
        getsqlsession=UserserviceImpl.getsqlsession;
    }


    public int count(String name,Integer type) {
        int count = getsqlsession.getMapper ( AdminDao.class ).count ( name, type );
        return count;
    }

    public List<Bill> dd(Integer Index, Integer size, String name, Integer type) {
        List<Bill> list = getsqlsession.getMapper ( AdminDao.class ).dd ( (Index - 1) * size, size, name, type );
        return list;
    }


    public int addBull(Bill bill) {
        int bull1 = getsqlsession.getMapper ( AdminDao.class ).addBull ( bill );
        return bull1;
    }


    public int remove(Integer id) {
        int remove =getsqlsession.getMapper ( AdminDao.class  ).remove ( id );
        return remove;
    }

    public Bill select(Integer id) {
        Bill bill = getsqlsession.getMapper ( AdminDao.class ).selectdao ( id );
        return bill;
    }

    public List<Provider> getProvider() {
        List<Provider> providers = getsqlsession.getMapper ( AdminDao.class ).getPrevider ();
        return providers;
    }

    public int seriveupdate(Bill id) {

        int daoupdate = getsqlsession.getMapper ( AdminDao.class ).daoupdate ( id);
        return daoupdate;
    }
}
